// 通知功能模块

/**
 * 显示通知
 * @param {string} title 通知标题
 * @param {string} message 通知内容
 * @param {string} type 通知类型 (success, error, warning, info)
 */
export function showNotification(title, message, type = 'info') {
    const notification = document.getElementById('notification');
    const notificationTitle = document.getElementById('notification-title');
    const notificationMessage = document.getElementById('notification-message');
    const notificationIcon = document.getElementById('notification-icon');
    
    if (!notification || !notificationTitle || !notificationMessage || !notificationIcon) return;
    
    // 设置通知内容和样式
    notificationTitle.textContent = title;
    notificationMessage.textContent = message;
    
    // 设置图标样式
    notificationIcon.className = 'w-8 h-8 rounded-full flex items-center justify-center';
    
    if (type === 'success') {
        notificationIcon.classList.add('bg-success/10', 'text-success');
        notificationIcon.innerHTML = '<i class="fa fa-check-circle"></i>';
    } else if (type === 'error') {
        notificationIcon.classList.add('bg-danger/10', 'text-danger');
        notificationIcon.innerHTML = '<i class="fa fa-exclamation-circle"></i>';
    } else if (type === 'warning') {
        notificationIcon.classList.add('bg-warning/10', 'text-warning');
        notificationIcon.innerHTML = '<i class="fa fa-exclamation-triangle"></i>';
    } else {
        notificationIcon.classList.add('bg-primary/10', 'text-primary');
        notificationIcon.innerHTML = '<i class="fa fa-info-circle"></i>';
    }
    
    // 显示通知
    notification.classList.remove('hidden');
    setTimeout(() => {
        notification.classList.remove('translate-x-full');
    }, 10);
    
    // 自动关闭通知
    setTimeout(() => {
        notification.classList.add('translate-x-full');
        setTimeout(() => {
            notification.classList.add('hidden');
        }, 300);
    }, 3000);
}